package com.heying.springcore.xml;

import com.heying.springcore.xml.Tank;

public class Driver {

    private String name;

    private int age;

    private Vehicle vehicle;

    public Vehicle getVehicle() {
        return vehicle;
    }

    public void setVehicle(Vehicle vehicle) {
        this.vehicle = vehicle;
    }

    public Driver(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Driver() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Driver{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public void drive(){
        System.out.println(this.age+"岁的"+this.name+"正在开车");
        vehicle.run();
//        car.run();
        //司机和车是依赖关系
    }
}
